$(function() {
			if ($("#hasItems").val() == "no") {
				orderConfirmTip("您目前购物车内没有商品，您可再去逛逛");
			}

			$("#chk_needInvoice").click(function() {
						if ($(this).attr("checked") == "checked") {
							$("#needInvoice").val(2);
							$("#table_invoice").show();
							$("#span_invoice_money_info").show();
							$("#total_money_add_invoice").show();
							$("#total_money_no_invoice").hide();
						} else {
							$("#needInvoice").val(1);
							$("#table_invoice").hide();
							$("#span_invoice_money_info").hide();
							$("#total_money_add_invoice").hide();
							$("#total_money_no_invoice").show();
						}
					});


		});
//跳转到支付页面
function toPay(){
alert($("#orderNo").val());
	var orderNo = $("#orderNo").val();
	var orderId = $("#orderId").val();
	var basePath = $("#basePath").val();
	alert(orderNo+"+"+basePath);
	window.location.href = basePath+"mall/order/toAlipay/"+orderNo+"/"+orderId;
}
function stay(url){
	window.open(url,'_blank');
	popload('mall/order/popload','containt');
}

function popload(url, divClassName){
	$.get(
		url,
		{"orderId":$("#orderId").val()},
		function (html){
			$("div").remove("." + divClassName);
			$(html).appendTo("body");
			loadCSS();
		}
	);
}

function loadCSS(){
	var winw = $(window).width();
	var winh = $(window).height();
	var popw = $(".pop_box").width();
	var poph = $(".pop_box").height();
	$(".pop_title").css("width",popw-4);
	var countw = (winw-popw)/2;
	var counth = (winh-poph)/2;
	$(".pop_box").css({"top":counth,"left":countw});
	$(".opcity").show();
	$(".pop_box").show();
	//弹出层拖拽
	iDrag({
	  target:$('#idrag-demo-root-target'),
	  root: $('#idrag-demo-root')
	});

}

	

function orderConfirmTip(tipContent) {
	var list = art.dialog.list;
	for (var i in list) {
		list[i].close();
	}
	art.dialog({
				title : "提示",
				content : tipContent,
				icon : "warning",
				drag : true,
				lock : true,
				esc : false,
				okVal : "返回购物车",
				cancelVal : "先看看其他商品",
				ok : function() {
					window.location.href = getRootUrl()+"mall/cart/index";
				},
				cancel : function() {
					window.location.href = getRootUrl()+"mall/index";
				}
			});
}